package com.czy.enchantmentvisualization.common;

import lombok.Data;

@Data
public class R<T> {

    private T data;
    private Integer code;
    private String msg;

    public static <T> R<T> ok(T data){
        R<T> r = new R<>();
        r.setData(data);
        r.setCode(200);
        r.setMsg("success");
        return r;
    }

    public static <T> R<T> error(T data){
        R<T> r = new R<>();
        r.setData(data);
        r.setCode(500);
        r.setMsg("error");
        return r;
    }

}
